package com.chengdu.chun.service.impl;

import com.chengdu.chun.mapper.StudentMapper;
import com.chengdu.chun.po.Student;
import com.chengdu.chun.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {

    @Autowired
    private StudentMapper studentMapper;

    @Override
    public Integer selectStudentCountByTeacher(int teacherid) {
        return studentMapper.selectCountByTeacher(teacherid);
    }

    @Override
    public int getStudentCountByroomTeacher() {
        return studentMapper.getStudentCountByroomTeacher();
    }

    @Override
    public List<Student> getStudentByClasses(int classesid) {
        return studentMapper.getStudentsByClasses(classesid);

    }

    @Override
    public List<Student> getStudentByRoom(int rid) {
        return studentMapper.getStudentByRoom(rid);
    }

    @Override
    public List<Student> getStudentBySnameAndMobile(long cid, String sname, String mobile) {
        return studentMapper.studentsBySnameAndMobile(cid, sname, mobile);

    }

    @Override
    public int insertStudent(Student student) {
        return studentMapper.insertStudent(student);
    }

    @Override
    public Student studentInfoBysid(Integer sid) {
        return studentMapper.studentInfoBysid(sid);
    }

    @Override
    public boolean changeStatus(Integer cstatus, Integer sid) {
        return studentMapper.changeStatus(cstatus, sid) > 0;
    }
}
